<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});


use Illuminate\Support\Facades\Route;

$api = app('Dingo\Api\Routing\Router');
$func = function ($api) {
    //需要token
    $api->group(['namespace' => 'App\Api\V2\Controller\Lite', 'prefix' => 'v2/Lite'], function ($api) {
        //服务商管理
        $api->group(["prefix" => "Provider", "middleware" => "user.api"], function ($api) {
            //添加服务商
            $api->post("addProvider", "ProviderController@addProvider");
            //更新服务商
            $api->post("upProvider", "ProviderController@upProvider");
            //服务商列表
            $api->get("listProvider", "ProviderController@listProvider");
            //服务商删除
            $api->post("delProvider", "ProviderController@delProvider");

            $api->get("listProviderSelect", "ProviderController@listProviderSelect");
        });
        //服务商授权
        //https://test-pay.zgjindoufu.com/api/v2/Notify/AliyunNotify/notify
        $api->group(["prefix" => "Oauth", "middleware" => "user.api"], function ($api) {
            $api->get("appAuth", "OauthController@appAuth");
        });
        //设备绑定
        $api->group(["prefix" => "Device", "middleware" => "user.api"], function ($api) {

            $api->post("deviceAdd", "DeviceController@deviceAdd");

            $api->post("deviceUp", "DeviceController@deviceUp");

            $api->post("deviceDel", "DeviceController@deviceDel");

            $api->get("deviceList", "DeviceController@deviceList");

            $api->get("deviceQuery", "DeviceController@deviceQuery");

            $api->post("deviceBind", "DeviceController@deviceBind");

            $api->post("deviceUnBind", "DeviceController@deviceUnBind");

        });

        //SPI操作
        //支付
        $api->group(["prefix" => "SpiPay"], function ($api) {

            $api->post("pay", "SpiPayController@pay");
            $api->post("payQuery", "SpiPayController@payQuery");
        });

        //退款
        $api->group(["prefix" => "SpiRefund"], function ($api) {

            $api->post("refund", "SpiRefundController@refund");
            $api->post("refundQuery", "SpiRefundController@refundQuery");
            $api->post("refundAuthCode", "SpiRefundController@refundAuthCode");

        });

        //对账统计
        $api->group(["prefix" => "SpiBill"], function ($api) {


            $api->post("billQuery", "SpiBillController@billQuery");

            $api->post("billDetailQuery", "SpiBillController@billDetailQuery");

            $api->post("billStaticQuery", "SpiBillController@billStaticQuery");


        });


        //收银
        $api->group(["prefix" => "Cashier"], function ($api) {
            $api->post("unsign", "CashierController@unsign");

            $api->post("sign", "CashierController@sign");

            $api->post("batchquery", "CashierController@batchquery");

            $api->post("query", "CashierController@query");

        });

    });
};
$api->version("v1", $func);










